Conditions | 2 |
Paths | 2 |
Total Lines | 28 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | var CRON = require('cron').CronJob; |
||
24 | var job = function(plugin) { |
||
25 | if (!plugin.cron.time){ return warn('Missing cron time table');} |
||
26 | info("Starting new job %s with cron %s", plugin.name, plugin.cron.time); |
||
27 | |||
28 | // Build callback |
||
29 | var next = function(data){ |
||
30 | if (!data){ return; } |
||
31 | if (data.error){ SARAH.speak(tts); } |
||
32 | |||
33 | var tts = SARAH.ScriptManager.speak(data.tts); |
||
34 | if (tts){ SARAH.speak(tts); } |
||
35 | |||
36 | SARAH.RuleEngine.dispatch(plugin.name, data); |
||
37 | } |
||
38 | |||
39 | // Create job |
||
40 | var job = new CRON({ |
||
41 | cronTime: plugin.cron.time, |
||
42 | onTick: function() { |
||
43 | info('Cron: %s', plugin.name); |
||
44 | plugin.getInstance().cron(next, plugin.cron, SARAH); |
||
45 | }, |
||
46 | start: true |
||
47 | }); |
||
48 | |||
49 | // Run once |
||
50 | plugin.getInstance().cron(next, plugin.cron, SARAH); |
||
51 | } |
||
52 | |||
63 | exports.init = CRONManager.init; |
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.